package org.yray.sip.factory;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.yray.sip.constant.SipCodeEnum;
import org.yray.sip.factory.inet.ISipEventFactory;

@Component
@Slf4j
public class SipEventFactory implements ISipEventFactory {


    @Override
    public void sipEvent(String callId, SipCodeEnum sipCode) {
        switch (sipCode)
        {
            case SIP_180:
            case SIP_100:
            case SIP_183:
                log.info(sipCode.getDisplayName());
                break;
            case SIP_404:
            case SIP_408:
            case SIP_480:
            case SIP_486:
            case SIP_487:
            case SIP_488:
            case SIP_4XX:
            case SIP_500:
            case SIP_503:
            case SIP_5XX:
                log.info(sipCode.getDisplayName());
                break;
            case SIP_OK_A:
            case SIP_OK_B:
                log.info(sipCode.getDisplayName());
                break;
            case SIP_BYE_A:
                log.info(sipCode.getDisplayName());
                break;
            case SIP_BYE_B:
                log.info(sipCode.getDisplayName());
                break;
            case SIP_OUTTIME:
                log.info(sipCode.getDisplayName());
                break;
            default:
                log.error("not impl the sip code callid={},sipcode={}",callId,sipCode);
        }
    }
}
